<template>
	<view>
		<view class="page">
			<comp-common v-bind="{data:data}" @getUserInfo="getUserInfo" @myLogin="myLogin" @getPhoneNumber="getPhoneNumber" @hideGetCoupon="hideGetCoupon" @closeCouponBox="closeCouponBox" @navigatorClick="navigatorClick"></comp-common>
			<comp-header v-bind="{data:data}" @relevanceError="relevanceError" @relevanceSuccess="relevanceSuccess"></comp-header>
			<view class="body after-navber">
				<view class="bottom-bar flex-row" v-if="data.is_area==1&&data.offline==0">
            <view class="is_area">所选地区暂时无货</view>
        </view>
        <form @submit="orderSubmit" reportSubmit="true" v-else>
            <view class="bottom-bar flex-row">
                <view class="flex-y-center flex-grow-1" style="padding: 0 24upx">
                    <view class="flex-grow-1" style="color:#ff4544 " v-if="data.pond_id||data.scratch_id||data.lottery_id">
                            总计：￥{{data.express_price}}
                        </view>
                    <view class="flex-grow-1" style="color:#ff4544 " v-else-if="data.step_id">
                            总计：{{data.total_price}}{{data.dapp.option.step.currency_name?data.dapp.option.step.currency_name:'活力币'}}
                            <text v-if="data.offline==0">+￥{{data.express_price}}</text>
                    </view>
                    <view class="flex-grow-1" style="color:#ff4544 " v-else>
                            总计：￥{{data.new_total_price}}
                        </view>
                </view>
                <button class="flex-y-center flex-grow-0 flex-x-center submit-btn" formType="submit" v-if="data.pond_id||data.scratch_id||data.lottery_id||data.step_id">提交</button>
                <block v-else>
                    <view class="flex-y-center flex-grow-0 flex-x-center submit-btn" style="background-color:#ccc;" v-if="data.offer_rule&&data.offer_rule.is_allowed==1&&data.offline==0">{{data.offer_rule.msg}}</view>
                    <button class="flex-y-center flex-grow-0 flex-x-center submit-btn" formType="submit" v-else>提交</button>
                </block>
            </view>
        </form>
        <view :class="[data.show_card?'no-scroll':'', data.show_shop||data.show_coupon_picker||data.show_card?'hidden':'']" style="padding-bottom: 129upx">
            <navigator class="flex-row address-picker" url="/pages/address-picker/address-picker" v-if="data.offline==0">
                <view class="flex-grow-1" v-if="data.address">
                    <view class="flex-row" style="margin-bottom: 20upx">
                        <view class="flex-grow-1">收货人：{{data.address.name}}</view>
                        <view class="flex-grow-0">{{data.address.mobile}}</view>
                    </view>
                    <view style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis">收货地址：{{data.address.province}}{{data.address.city}}{{data.address.district}}{{data.address.detail}}</view>
                </view>
                <view class="flex-grow-1" v-else>
                    <view style="color:#ff4544">请选择收货地址</view>
                </view>
                <view class="flex-grow-0 flex-y-center">
                    <image :src="data.__wxapp_img.dapp.jiantou_r.url" style="width: 12upx; height: 22upx;margin-left: 24upx"></image>
                </view>
            </navigator>
            <view @tap="showPayment" class="flex-row flex-y-center" style="background: #fff;padding: 0 24upx;height: 90upx;border-bottom: 1upx solid #e3e3e3;margin-bottom: 20upx;">
                <view class="flex-grow-1">支付方式</view>
                <view class="flex-grow-0" v-if="data.payment==0">线上支付</view>
                <view class="flex-grow-0" v-if="data.payment==2">货到付款</view>
                <view class="flex-grow-0" v-if="data.payment==3">账户余额支付</view>
                <view class="flex-grow-0">
                    <image :src="data.__wxapp_img.dapp.jiantou_r.url" style="width: 12upx;height: 22upx;margin-left: 12upx"></image>
                </view>
            </view>
            <view class="store-item" v-if="data.goods_list&&data.goods_list.length>0">
                <view class="store-header">平台自营</view>
                <view class="cart-list">
                    <view class="flex-col " v-for="(item,index) in data.goods_list" :key="index">
                        <view class="cart-item flex-row border-bottom">
                            <view class="flex-grow-0">
                                <image class="goods-pic" mode="aspectFill" :src="item.goods_pic"></image>
                            </view>
                            <view class="flex-grow-1 flex-col">
                                <view class="flex-grow-1">
                                    <view class="goods-name">{{item.goods_name}}</view>
                                    <view class="attr-list">
                                        <view class="attr-item" v-for="(attr,i) in item.attr_list" :key="i">
                                            {{attr.attr_group_name}}:{{attr.attr_name}}
                                        </view>
                                    </view>
                                </view>
                                <view class="flex-grow-0 flex-row">
                                    <view class="flex-grow-1 num">×{{item.num}}</view>
                                    <view class="flex-grow-0 price" v-if="!data.pond_id&&!data.scratch_id&&!data.lottery_id&&!data.step_id">￥:{{item.price}}</view>
                                </view>
                            </view>
                        </view>
                        <view class="goods-intrgral flex-row" v-if="item.give>0&&!data.pond_id&&!data.scratch_id&&!data.lottery_id&&!data.step_id">
                            <view class="flex-y-center"> 订单完成返回</view>
                            <view class="flex-y-center" style="color:#ff4544">{{item.give}}</view>
                            <view class="flex-y-center">积分</view>
                        </view>
                    </view>
                </view>
                <view class="flex flex-row flex-y-center border-bottom" style="background-color:#fff;padding:0 24upx;height:90upx;" v-if="data.send_type==0">
                    <view class="flex-grow-1">配送方式</view>
                    <view class="flex-grow-0 flex-row">
                        <view @tap="getOffline" :class="['flex-y-center flex-row', data.offline==0?'active':'']" data-index="0" style="height:100%;">
                            <view class="check-icon"></view>
                            <view>快递配送</view>
                        </view>
                        <view @tap="getOffline" :class="['flex-y-center flex-row', data.offline==1?'active':'']" data-index="1" style="height:100%;margin-left: 32upx">
                            <view class="check-icon"></view>
                            <view>到店自提</view>
                        </view>
                    </view>
                </view>
                <block v-if="data.offline==1">
                    <view class="flex-row flex-y-center border-bottom" style="padding: 0 24upx;height: 90upx;background: #fff">
                        <view class="flex-grow-1">
                            <view class="flex-row">
                                <view class="flex-grow-0">联系人：</view>
                                <view class="flex-grow-1" style="padding-left: 24upx">
                                    <input @input="KeyName" placeholder="请填写姓名" style="width: 300upx" :value="data.name"></input>
                                </view>
                            </view>
                        </view>
                        <view class="flex-grow-0">
                            <input @input="KeyMobile" placeholder="请填写电话" style="width: 300upx;text-align: right" :value="data.mobile"></input>
                        </view>
                    </view>
                    <view :@tap="data.shop_list.length>1?'showShop':''" class="flex-row border-bottom" style="background: #fff;padding: 24upx">
                        <view class="flex-grow-1">
                            <view class="flex-row" style="margin-bottom: 20upx">
                                <view class="flex-grow-1">门店名称：{{data.shop.name}}</view>
                            </view>
                            <view class="flex-row" style="margin-bottom: 20upx">
                                <view class="flex-grow-1">门店电话：{{data.shop.mobile}}</view>
                            </view>
                            <view>门店地址：{{data.shop.address}}</view>
                        </view>
                        <view class="flex-grow-0 flex-y-center" v-if="data.shop_list.length>1">
                            <image :src="data.__wxapp_img.dapp.jiantou_r.url" style="width: 12upx;height: 22upx;margin-left: 12upx"></image>
                        </view>
                    </view>
                </block>
                <view @tap="showCouponPicker" class="flex-row flex-y-center border-bottom" style="background: #fff;padding: 0 24upx;height: 90upx;" v-if="!data.pond_id&&!data.scratch_id&&!data.lottery_id&&!data.step_id">
                    <view class="flex-grow-1">优惠券</view>
                    <view class="flex-grow-0">
                        <view style="color: #888" v-if="!data.coupon_list||data.coupon_list.length==0">目前无可用优惠券</view>
                        <block v-else>
                            <view style="color: #ff4544" v-if="data.picker_coupon">-{{data.picker_coupon.sub_price}}元</view>
                            <view style="color: #ff4544" v-else>有{{data.coupon_list.length}}张优惠券可以使用</view>
                        </block>
                    </view>
                    <view class="flex-grow-0">
                        <image :src="data.__wxapp_img.dapp.jiantou_r.url" style="width: 12upx;height: 22upx;margin-left: 12upx"></image>
                    </view>
                </view>
                <view class="flex-row flex-y-center border-bottom" style="background: #fff;padding: 0 24upx;height: 90upx;border-bottom: 1upx solid #e3e3e3;" v-if="data.integral.forehead_integral>0&&!data.pond_id&&!data.scratch_id&&!data.lottery_id&&!data.step_id">
                    <view class="flex-grow-1 flex-y-center">
                        <view class="flex-y-center">使用{{data.integral.forehead_integral}}积分抵扣</view>
                        <view class="flex-y-center" style="color:#ff4544">{{data.integral.forehead}}</view>
                        <view class="flex-y-center">元</view>
                        <view @tap="integration" class="flex-y-center">
                            <image :src="data.__wxapp_img.dapp.ntegration.url" style="width: 36upx;height: 36upx;margin-left: 12upx"></image>
                        </view>
                    </view>
                    <view class="flex-grow-0 flex-y-center integral-switch" :data-index="data.integral_radio">
                        <switch checked @change="integralSwitchChange" class="flex-y-center" style="height:44upx"></switch>
                    </view>
                </view>
                <view class="flex-row flex-y-center border-bottom" style="background: #fff;padding: 0 24upx;height: 90upx" v-if="data.level&&!data.pond_id&&!data.scratch_id&&!data.lottery_id&&!data.step_id">
                    <view class="flex-grow-1">会员折扣</view>
                    <view class="flex-grow-0">
                        <view style="color:#ff4544">{{data.level.discount}}折</view>
                    </view>
                </view>
                <view class="flex-row flex-y-center border-bottom" style="background: #fff;padding: 0 24upx;height: 90upx">
                    <view class="flex-grow-1">运费</view>
                    <view class="flex-grow-0">
                        <block v-if="data.offline==0">
                            <view style="color:#ff4544" v-if="address">￥{{data.express_price}}</view>
                            <view style="color:#888" v-else>请先选择收货地址</view>
                        </block>
                        <view style="color:#ff4544" v-else-if="data.offline==1">￥0</view>
                    </view>
                </view>
                <view class="flex flex-row flex-y-center border-bottom" style="background: #fff;padding: 0 24upx;height: 90upx" v-if="data.form.is_form==0">
                    <view class="flex-grow-0">买家留言</view>
                    <view class="flex-grow-0" style="padding-left: 24upx">
                        <input @input="bindkeyinput" data-store-index="-1" name="content" placeholder="请填写备注" style="width:100%;" :value="data.content"></input>
                    </view>
                </view>
                <view class="address-picker" style="padding:0 24upx;" v-if="data.form.is_form==1&&data.form.list.length>0&&!data.step_id">
                    <view class="form-title text-more">{{data.form.name?data.form.name:'表单信息'}}</view>
                    <view class="form-list">
                        <view class="form-one flex-row" v-for="(item,index) in data.form.list" :key="index">
                            <view :class="['flex-grow-0 list-name', item.type=='text'?'flex-y-center':'', item.required==1?'required':'']">{{item.name}}</view>
                            <view class="flex-grow-1 flex-y-center" v-if="item.type=='text'">
                                <input @confirm="formInput" @input="formInput" @blur="formInput" :data-index="index" :placeholder="item.tip" type="text" :value="item.default"></input>
                            </view>
                            <view class="flex-grow-1" v-if="item.type=='textarea'">
                                <textarea autoHeight="true" @confirm="formInput" @input="formInput" @blur="formInput" :data-index="index" :placeholder="item.tip" style="width:auto;max-height:400upx;height:auto" :value="item.default"></textarea>
                            </view>
                            <block v-if="item.type=='time'">
                                <view class="flex-grow-1" style="justify-content:flex-end;text-align:right;">
                                    <picker @change="formInput" :data-index="index" end="23:59" mode="time" start="00:00" :value="item.default?item.default:'00:00'">
                                        <view>{{item.default?item.default:'00:00'}}</view>
                                    </picker>
                                </view>
                                <view class="flex-grow-0">
                                    <image class="right-jiantou" :src="data.__wxapp_img.dapp.jiantou_r.url"></image>
                                </view>
                            </block>
                            <block v-if="item.type=='date'">
                                <view class="flex-grow-1" style="justify-content:flex-end;text-align:right;">
                                    <picker @change="formInput" :data-index="index" mode="date" :start="data.time" :value="item.default?item.default:data.time">
                                        <view>{{item.default?item.default:data.time}}</view>
                                    </picker>
                                </view>
                                <view class="flex-grow-0">
                                    <image class="right-jiantou" :src="data.__wxapp_img.dapp.jiantou_r.url"></image>
                                </view>
                            </block>
                            <view class="flex-grow-1 flex-row" style="flex-wrap:wrap" v-if="item.type=='radio'">
                                <view @tap="selectForm" :class="['default', v.is_selected==1?'d-active':'']" :data-index="index" :data-k="k" v-for="(v,k) in item.default_list" :key="k">{{v.name}}</view>
                            </view>
                            <view class="flex-grow-1 flex-row" style="flex-wrap:wrap" v-if="item.type=='checkbox'">
                                <view @tap="selectForm" :class="['default', v.is_selected==1?'d-active':'']" :data-index="index" :data-k="k" style="border-radius:0" v-for="(v,k) in item.default_list" :key="k">{{v.name}}</view>
                            </view>
                            <block v-if="item.type=='uploadImg'">
                                <view @tap="uploadImg" class="flex-grow-1 flex-y-center" :data-index="index">
                                    <view style="text-align:right;width:100%;font-size:0" v-if="item.default">
                                        <image mode="aspectFit" :src="item.default" style="width:88upx;height:96upx"></image>
                                    </view>
                                    <view style="text-align:right;width:100%;color:#c9c9c9;" v-else>
                                        <view>{{item.tip?item.tip:'请选择图片'}}</view>
                                    </view>
                                </view>
                                <view class="flex-grow-0 flex-y-center">
                                    <image :src="data.__wxapp_img.balance.right.url" style="width:12upx;height:18upx;margin-left:18upx;"></image>
                                </view>
                            </block>
                        </view>
                    </view>
                </view>
            </view>
            <block v-if="data.store_list&&data.store_list.length>0">
                <view class="store-item" v-for="(store,store_index) in data.store_list" :key="store_index">
                    <view class="store-header">{{store.name}}</view>
                    <view class="cart-list">
                        <view class="flex-col " v-for="(item,index) in data.store.list" :key="index">
                            <view class="cart-item flex-row border-bottom">
                                <view class="flex-grow-0">
                                    <image class="goods-pic" mode="aspectFill" :src="item.goods_pic"></image>
                                </view>
                                <view class="flex-grow-1 flex-col">
                                    <view class="flex-grow-1">
                                        <view class="goods-name">{{item.goods_name}}</view>
                                        <view class="attr-list">
                                            <view class="attr-item" v-for="(attr,i) in item.attr_list" :key="i">
                                                {{attr.attr_group_name}}:{{attr.attr_name}}
                                            </view>
                                        </view>
                                    </view>
                                    <view class="flex-grow-0 flex-row">
                                        <view class="flex-grow-1 num">×{{item.num}}</view>
                                        <view class="flex-grow-0 price">￥:{{item.price}}</view>
                                    </view>
                                </view>
                            </view>
                            <view class="goods-intrgral flex-row" v-if="item.give>0">
                                <view class="flex-y-center"> 订单完成返回</view>
                                <view class="flex-y-center" style="color:#ff4544">{{item.give}}</view>
                                <view class="flex-y-center">积分</view>
                            </view>
                        </view>
                    </view>
                    <view class="flex-row flex-y-center border-bottom" style="background: #fff;padding: 0 24upx;height: 90upx">
                        <view class="flex-grow-1">运费</view>
                        <view class="flex-grow-0">
                            <view style="color:#ff4544" v-if="data.address">￥{{store.express_price}}</view>
                            <view style="color:#888" v-else>请先选择收货地址</view>
                        </view>
                    </view>
                    <view class="flex flex-row flex-y-center border-bottom" style="background: #fff;padding: 0 24upx;height: 90upx">
                        <view class="flex-grow-0">买家留言</view>
                        <view class="flex-grow-0" style="padding-left: 24upx">
                            <input @input="bindkeyinput" :data-store-index="store_index" name="content" placeholder="请填写备注" style="width:100%;" :value="store.content"></input>
                        </view>
                    </view>
                </view>
            </block>
        </view>
        <view class="coupon-picker" v-if="data.show_coupon_picker">
            <scroll-view class="coupon-list" scrollY="true" style="height: 100%">
                <view style="color: #888;font-size: 9pt;margin-bottom: 20upx;line-height: 1.35">
                    注：优惠券只能抵消商品金额，不能抵消运费，商品金额最多优惠到0.01元
                </view>
                <view @tap="pickCoupon" class="flex-y-center flex-x-center" data-index="-1" style="height: 80upx;margin-bottom: 24upx;color: #888;border: 1upx solid #e3e3e3;border-radius: 10upx">不使用优惠券
                </view>
                <view @tap="pickCoupon" :class="['coupon-item', 'coupon-status-'+item.status, data.picker_coupon&&item.user_coupon_id==data.picker_coupon.user_coupon_id?'active':'']" :data-index="index" v-for="(item,index) in data.coupon_list" :key="index">
                    <image class="coupon-bg" :src="'/static/images/img-coupon-bg-'+item.status==0?0:1+'.png'"></image>
                    <image class="coupon-status-icon" :src="'/static/images/img-coupon-status-icon-'+item.status+'.png'" v-if="item.status!=0"></image>
                    <view class="flex-row" style="height: 100%;overflow: hidden">
                        <view class="flex-grow-0 flex-col flex-y-center flex-x-center coupon-left">
                            <view class="flex-row flex-y-bottom">
                                <view style="font-size: 9pt">￥</view>
                                <view :style="{fontSize: item.sub_price.length>4?'13':'19'+'pt',lineHeight: '.9'}">
                                    {{item.sub_price}}
                                </view>
                            </view>
                            <view style="font-size: 8pt;margin-top: 10upx">{{item.min_price_desc}}</view>
                        </view>
                        <view class="flex-grow-1 flex-y-center coupon-right">
                            <view style="width: 100%">
                                <view class="flex-row flex-y-center mb-10">
                                    <view class="flex-grow-1" style="font-size: 13pt;font-weight: bold">{{item.event_desc}}
                                    </view>
                                    <view class="flex-grow-0" style="font-size: 9pt"></view>
                                </view>
                                <view style="font-size: 8pt;color: #888">{{item.begin_time}} ~ {{item.end_time}}</view>
                            </view>
                        </view>
                    </view>
                </view>
            </scroll-view>
        </view>
        <view class="coupon-picker" style="background-color:#f7f7f7;" v-if="data.show_shop">
            <scroll-view class="coupon-list" scrollY="true" style="height: 100%;padding:0;">
                <view class="shop-block flex-y-center">当前地址</view>
                <view class="shop-address flex-row flex-y-center">
                    <view class="flex-grow-1">{{data.location}}</view>
                    <view @tap="dingwei" class="flex-grow-0 flex-y-center">
                        <image :src="data.__wxapp_img.shop.dingwei.url" style="width:32upx;height:32upx;margin-right:2upx;"></image>
                        <text style="color:#2495ff">手动定位</text>
                    </view>
                </view>
                <view class="shop-block flex-y-center">门店列表（仅展示您最近的30家门店）</view>
                <view @tap="pickShop" class="flex-row address-picker" :data-index="index" style="margin:0;" v-for="(item,index) in data.shop_list" :key="index">
                    <view class="flex-grow-0 flex-y-center">
                        <image :src="item.id==data.shop.id?'/static/images/icon-shop-checked.png':'/static/images/icon-shop-un.png'" style="width: 40upx;height: 40upx;margin-right: 20upx"></image>
                    </view>
                    <view class="flex-grow-1">
                        <view class="flex-row" style="margin-bottom: 20upx">
                            <view class="flex-grow-1" style="font-weight:bold;" :style="item.id==data.shop.id?'color:#ff4544':''">
                                {{item.name}}
                            </view>
                            <view class="flex-grow-0" v-if="item.distance!=-1">{{item.distance}}</view>
                        </view>
                        <view class="flex-row" style="margin-bottom: 20upx">
                            <view class="flex-grow-1">电话：{{item.mobile}}</view>
                        </view>
                        <view>地址：{{item.address}}</view>
                    </view>
                </view>
            </scroll-view>
        </view>
        <view class="payment" v-if="data.show_payment">
            <view class="pay-modal">
                <view class="pay-head flex-x-center flex-y-center">请选择支付方式</view>
                <view @tap="payPicker" class="pay-block flex-row flex-y-center" :data-index="item.payment" v-for="(item,index) in data.pay_type_list" :key="index">
                    <view class="flex-grow-0">
                        <image :src="item.icon" style="width:72upx;height:72upx;margin-right:30upx;"></image>
                    </view>
                    <view :class="['flex-grow-1', data.payment==item.payment?'red':'']">{{item.name}}</view>
                    <view class="flex-grow-0" v-if="data.payment==item.payment">
                        <image :src="data.__wxapp_img.dapp.pay_right.url" style="width:34upx;height:24upx;"></image>
                    </view>
                </view>
                <view @tap="payClose" class="pay-footer flex-x-center flex-y-center hidden">关闭</view>
            </view>
        </view>
				<get-card v-bind="{data:data}" @cardDel="cardDel" @cardTo="cardTo"></get-card>
			</view>
			<comp-footer v-bind="{data:data}"></comp-footer>
		</view>
	</view>
</template>

<script>var myVue = {};
	import Vue from 'vue'
	import getCard from '../../components/get-card/get-card.vue'
	var t = "", a = "", e = Vue.prototype.getApp.helper, i = !1;
	export default {
		components:{getCard},
		data() {
			return {
				data: {
        total_price: 0,
        address: null,
        express_price: 0,
        content: "",
        offline: 0,
        express_price_1: 0,
        name: "",
        mobile: "",
        integral_radio: 1,
        new_total_price: 0,
        show_card: !1,
        payment: -1,
        show_payment: !1,
        pond_id: !1,
        scratch_id: !1,
        lottery_id: !1,
        setp_id: !1
    },
			};
		},
		onLoad: function(t) {myVue = this;
        myVue.getApp.page.onLoad(this, t);
        var a = this, i = e.formatData(new Date());
        myVue.getApp.core.removeStorageSync(myVue.getApp.const.INPUT_DATA), t.pond_id && a.setData({
            pond_id: t.pond_id
        }), t.scratch_id && a.setData({
            scratch_id: t.scratch_id
        }), t.lottery_id && a.setData({
            lottery_id: t.lottery_id
        }), t.step_id && a.setData({
            step_id: t.step_id
        }), a.setData({
            options: t,
            time: i
        });
    },
		onShow: function(t) {
        if (!myVue.getApp.onShowData || !myVue.getApp.onShowData.scene || 1034 != myVue.getApp.onShowData.scene && "pay" != myVue.getApp.onShowData.scene) if (i) i = !1; else {
            getCurrentPages();
            myVue.getApp.page.onShow(this);
            var a = this, e = myVue.getApp.core.getStorageSync(myVue.getApp.const.PICKER_ADDRESS);
            if (e) {
                a.data.is_area_city_id;
                var s = {};
                s.address = e, s.name = e.name, s.mobile = e.mobile, myVue.getApp.core.removeStorageSync(myVue.getApp.const.PICKER_ADDRESS), 
                a.setData(s), a.getInputData();
            }
            a.getOrderData(a.data.options);
        }
    },
		onHide: function() {
        myVue.getApp.page.onHide(this), this.getInputData();
    },
    onUnload: function() {
        myVue.getApp.page.onUnload(this), myVue.getApp.core.removeStorageSync(myVue.getApp.const.INPUT_DATA);
    },
		methods: {
			bindkeyinput: function(t) {
        var a = t.currentTarget.dataset.storeIndex;
        -1 == a ? this.setData({
            content: t.detail.value
        }) : (this.data.store_list[a] && (this.data.store_list[a].content = t.detail.value),
        this.setData({
            store_list: this.data.store_list
        }));
    },
    KeyName: function(t) {
        this.setData({
            name: t.detail.value
        });
    },
    KeyMobile: function(t) {
        this.setData({
            mobile: t.detail.value
        });
    },
    getOffline: function(t) {
        var a = this, e = this.data.express_price, i = this.data.express_price_1;
        1 == t.currentTarget.dataset.index ? this.setData({
            offline: 1,
            express_price: 0,
            express_price_1: e,
            is_area: 0
        }) : this.setData({
            offline: 0,
            express_price: i
        }), a.getPrice();
    },
    dingwei: function() {
        var e = this;
        myVue.getApp.getauth({
            content: "需要获取您的地理位置授权，请到小程序设置中打开授权",
            author: "scope.userLocation",
            success: function(i) {
                i && (i.authSetting["scope.userLocation"] ? myVue.getApp.core.chooseLocation({
                    success: function(i) {
                        t = i.longitude, a = i.latitude, e.setData({
                            location: i.address
                        });
                    }
                }) : myVue.getApp.core.showToast({
                    title: "您取消了授权",
                    image: "/static/images/icon-warning.png"
                }));
            }
        });
    },
    orderSubmit: function(t) {
        var a = this, e = a.data.offline, i = {};
        if (0 == e) {
            if (1 == a.data.is_area) return void myVue.getApp.core.showToast({
                title: "所选地区无货",
                image: "/static/images/icon-warning.png"
            });
            if (!a.data.address || !a.data.address.id) return void myVue.getApp.core.showToast({
                title: "请选择收货地址",
                image: "/static/images/icon-warning.png"
            });
            i.address_id = a.data.address.id;
        } else {
            if (i.address_name = a.data.name, i.address_mobile = a.data.mobile, !a.data.shop.id) return void myVue.getApp.core.showModal({
                title: "警告",
                content: "请选择门店",
                showCancel: !1
            });
            if (i.shop_id = a.data.shop.id, !i.address_name || void 0 == i.address_name) return void a.showToast({
                title: "请填写联系人",
                image: "/static/images/icon-warning.png"
            });
            if (!i.address_mobile || void 0 == i.address_mobile) return void a.showToast({
                title: "请填写联系方式",
                image: "/static/images/icon-warning.png"
            });
        }
        i.offline = e;
        var s = a.data.form;
        if (1 == s.is_form && a.data.goods_list && a.data.goods_list.length) {
            var o = s.list;
            for (var d in o) if ("date" == o[d].type && (o[d].default = o[d].default ? o[d].default : a.data.time), 
            "time" == o[d].type && (o[d].default = o[d].default ? o[d].default : "00:00"), 1 == o[d].required) if ("radio" == o[d].type || "checkboxc" == o[d].type) {
                var r = !1;
                for (var n in o[d].default_list) 1 == o[d].default_list[n].is_selected && (r = !0);
                if (!r) return myVue.getApp.core.showModal({
                    title: "提示",
                    content: "请填写" + s.name + "，加‘*’为必填项",
                    showCancel: !1
                }), !1;
            } else if (!o[d].default || void 0 == o[d].default) return myVue.getApp.core.showModal({
                title: "提示",
                content: "请填写" + s.name + "，加‘*’为必填项",
                showCancel: !1
            }), !1;
        }
        if (a.data.pond_id > 0 || a.data.scratch_id > 0 || a.data.lottery_id > 0 || a.data.step_id > 0) {
            if (a.data.express_price > 0 && -1 == a.data.payment) return a.setData({
                show_payment: !0
            }), !1;
        } else if (-1 == a.data.payment) return a.setData({
            show_payment: !0
        }), !1;
        if (i.form = JSON.stringify(s), a.data.cart_id_list && (i.cart_id_list = JSON.stringify(a.data.cart_id_list)), 
        a.data.store_list && a.data.store_list.length) {
            var c = [];
            for (var d in a.data.store_list) if (a.data.store_list[d].cart_id_list) {
                var p = {
                    id: a.data.store_list[d].id,
                    cart_id_list: a.data.store_list[d].cart_id_list
                };
                a.data.store_list[d].content && (p.content = a.data.store_list[d].content), c.push(p);
            }
            c.length ? i.store_list = JSON.stringify(c) : i.store_list = "";
        }
        a.data.goods_info && (i.goods_info = JSON.stringify(a.data.goods_info)), a.data.picker_coupon && (i.user_coupon_id = a.data.picker_coupon.user_coupon_id), 
        a.data.content && (i.content = a.data.content), a.data.cart_list && (i.cart_list = JSON.stringify(a.data.cart_list)), 
        1 == a.data.integral_radio ? i.use_integral = 1 : i.use_integral = 2, a.data.goods_list && a.data.goods_list.length || !a.data.store_list || 1 != a.data.store_list.length || (i.content = a.data.store_list[0].content ? a.data.store_list[0].content : ""),
        i.payment = a.data.payment, i.formId = t.detail.formId, i.pond_id = a.data.pond_id, 
        i.scratch_id = a.data.scratch_id, i.step_id = a.data.step_id, i.lottery_id = a.data.lottery_id, 
        i.pond_id ? a.order_submit(i, "pond") : i.scratch_id ? a.order_submit(i, "scratch") : i.lottery_id ? a.order_submit(i, "lottery") : i.step_id ? a.order_submit(i, "step") : a.order_submit(i, "s");
    },
		getOrderData: function(e) {
        var i = this, s = {}, o = "";
        if (i.data.address && i.data.address.id && (o = i.data.address.id), s.address_id = o, 
        s.longitude = t, s.latitude = a, myVue.getApp.core.showLoading({
            title: "正在加载",
            mask: !0
        }), e.cart_list) {
            JSON.parse(e.cart_list);
            s.cart_list = e.cart_list;
        }
        if (e.cart_id_list) {
            var d = JSON.parse(e.cart_id_list);
            s.cart_id_list = d;
        }
        if (e.store_list) {
            var r = JSON.parse(e.store_list);
            s.store_list = r;
        }
        e.goods_info && (s.goods_info = e.goods_info), e.bargain_order_id && (s.bargain_order_id = e.bargain_order_id), 
        myVue.getApp.request({
            url: myVue.getApp.api.order.submit_preview,
            data: s,
            success: function(t) {
                if (i.getApp.core.hideLoading(), 0 == t.code) {
                    var a = i.getApp.core.getStorageSync(i.getApp.const.INPUT_DATA);
                    i.getApp.core.removeStorageSync(i.getApp.const.INPUT_DATA);
                    var e = [], s = t.data.coupon_list;
                    for (var o in s) null != s[o] && e.push(s[o]);
                    var d = t.data.shop_list, r = {};
                    d && 1 == d.length && (r = d[0]), t.data.is_shop && (r = t.data.is_shop), a || ((a = {
                        shop: r,
                        address: t.data.address || null,
                        name: t.data.address ? t.data.address.name : "",
                        mobile: t.data.address ? t.data.address.mobile : "",
                        pay_type_list: t.data.pay_type_list,
                        form: t.data.form
                    }).pay_type_list.length > 1 ? a.payment = -1 : a.payment = a.pay_type_list[0].payment), 
                    a.total_price = t.data.total_price || 0, a.goods_list = t.data.list || null, a.express_price = parseFloat(t.data.express_price), 
                    a.coupon_list = s, a.shop_list = d, a.send_type = t.data.send_type, a.level = t.data.level, 
                    a.new_total_price = t.data.total_price || 0, a.integral = t.data.integral, a.goods_card_list = t.data.goods_card_list || [], 
                    a.is_payment = t.data.is_payment, a.store_list = t.data.store_list || null, a.is_area_city_id = t.data.is_area_city_id,
                    a.pay_type_list = t.data.pay_type_list, a.offer_rule = t.data.offer_rule, a.is_area = t.data.is_area, 
                    i.setData(a), i.getInputData(), t.data.goods_info && i.setData({
                        goods_info: t.data.goods_info
                    }), t.data.cart_id_list && i.setData({
                        cart_id_list: t.data.cart_id_list
                    }), t.data.cart_list && i.setData({
                        cart_list: t.data.cart_list
                    }), 1 == t.data.send_type && i.setData({
                        offline: 0
                    }), 2 == t.data.send_type && i.setData({
                        offline: 1
                    }), i.getPrice();
                }
                1 == t.code && i.getApp.core.showModal({
                    title: "提示",
                    content: t.msg,
                    showCancel: !1,
                    confirmText: "返回",
                    success: function(t) {
                        t.confirm && i.getApp.core.navigateBack({
                            delta: 1
                        });
                    }
                });
            }
        });
    },
    copyText: function(t) {
        var a = t.currentTarget.dataset.text;
        a && myVue.getApp.core.setClipboardData({
            data: a,
            success: function() {
                self.showToast({
                    title: "已复制内容"
                });
            },
            fail: function() {
                self.showToast({
                    title: "复制失败",
                    image: "/static/images/icon-warning.png"
                });
            }
        });
    },
    showCouponPicker: function() {
        var t = this;
        t.getInputData(), t.data.coupon_list && t.data.coupon_list.length > 0 && t.setData({
            show_coupon_picker: !0
        });
    },
    pickCoupon: function(t) {
        var a = this, e = t.currentTarget.dataset.index, i = myVue.getApp.core.getStorageSync(myVue.getApp.const.INPUT_DATA);
        myVue.getApp.core.removeStorageSync(myVue.getApp.const.INPUT_DATA), "-1" == e || -1 == e ? (i.picker_coupon = !1, 
        i.show_coupon_picker = !1) : (i.picker_coupon = a.data.coupon_list[e], i.show_coupon_picker = !1), 
        a.setData(i), a.getPrice();
    },
    numSub: function(t, a, e) {
        return 100;
    },
    showShop: function(t) {
        var a = this;
        a.getInputData(), a.dingwei(), a.data.shop_list && a.data.shop_list.length >= 1 && a.setData({
            show_shop: !0
        });
    },
    pickShop: function(t) {
        var a = this, e = t.currentTarget.dataset.index, i = myVue.getApp.core.getStorageSync(myVue.getApp.const.INPUT_DATA);
        myVue.getApp.core.removeStorageSync(myVue.getApp.const.INPUT_DATA), "-1" == e || -1 == e ? (i.shop = !1, 
        i.show_shop = !1) : (i.shop = a.data.shop_list[e], i.show_shop = !1), a.setData(i), 
        a.getPrice();
    },
    integralSwitchChange: function(t) {
        var a = this;
        0 != t.detail.value ? a.setData({
            integral_radio: 1
        }) : a.setData({
            integral_radio: 2
        }), a.getPrice();
    },
    integration: function(t) {
        var a = this.data.integral.integration;
        myVue.getApp.core.showModal({
            title: "积分使用规则",
            content: a,
            showCancel: !1,
            confirmText: "我知道了",
            confirmColor: "#ff4544",
            success: function(t) {
                t.confirm;
            }
        });
    },
    getPrice: function() {
        var t = this, a = t.data.total_price, e = t.data.express_price, i = t.data.picker_coupon, s = t.data.integral, o = t.data.integral_radio, d = t.data.level, r = t.data.offline;
        if (t.data.goods_list && t.data.goods_list.length > 0 && (i && (a -= i.sub_price), 
        s && 1 == o && (a -= parseFloat(s.forehead)), d && (a = a * d.discount / 10), a <= .01 && (a = .01), 
        0 == r && (a += e)), t.data.store_list && t.data.store_list.length) for (var n in t.data.store_list) a += t.data.store_list[n].total_price + t.data.store_list[n].express_price;
        t.setData({
            new_total_price: parseFloat(a.toFixed(2))
        });
    },
    cardDel: function() {
        this.setData({
            show_card: !1
        }), myVue.getApp.core.redirectTo({
            url: "/pages/order/order?status=1"
        });
    },
    cardTo: function() {
        this.setData({
            show_card: !1
        }), myVue.getApp.core.redirectTo({
            url: "/pages/card/card"
        });
    },
    formInput: function(t) {
        var a = this, e = t.currentTarget.dataset.index, i = a.data.form, s = i.list;
        s[e].default = t.detail.value, i.list = s, a.setData({
            form: i
        });
    },
    selectForm: function(t) {
        var a = this, e = t.currentTarget.dataset.index, i = t.currentTarget.dataset.k, s = a.data.form, o = s.list;
        if ("radio" == o[e].type) {
            var d = o[e].default_list;
            for (var r in d) r == i ? d[i].is_selected = 1 : d[r].is_selected = 0;
            o[e].default_list = d;
        }
        "checkbox" == o[e].type && (1 == (d = o[e].default_list)[i].is_selected ? d[i].is_selected = 0 : d[i].is_selected = 1, 
        o[e].default_list = d), s.list = o, a.setData({
            form: s
        });
    },
    showPayment: function() {
        this.setData({
            show_payment: !0
        });
    },
    payPicker: function(t) {
        var a = t.currentTarget.dataset.index;
        this.setData({
            payment: a,
            show_payment: !1
        });
    },
    payClose: function() {
        this.setData({
            show_payment: !1
        });
    },
    getInputData: function() {
        var t = this, a = {
            address: t.data.address,
            content: t.data.content,
            name: t.data.name,
            mobile: t.data.mobile,
            integral_radio: t.data.integral_radio,
            payment: t.data.payment,
            shop: t.data.shop,
            form: t.data.form,
            picker_coupon: t.data.picker_coupon
        };
        myVue.getApp.core.setStorageSync(myVue.getApp.const.INPUT_DATA, a);
    },
		uploadImg: function(t) {
        var a = this, e = t.currentTarget.dataset.index, s = a.data.form;
        i = !0, myVue.getApp.uploader.upload({
            start: function() {
                myVue.getApp.core.showLoading({
                    title: "正在上传",
                    mask: !0
                });
            },
            success: function(t) {
                0 == t.code ? (s.list[e].default = t.data.url, a.setData({
                    form: s
                })) : a.showToast({
                    title: t.msg
                });
            },
            error: function(t) {
                a.showToast({
                    title: t
                });
            },
            complete: function() {
                myVue.getApp.core.hideLoading();
            }
        });
    }
		},
	}
</script>

<style scoped>

.bottom-bar {
    position: fixed;
    bottom: var(--window-bottom);
    left: 0;
    height: 120upx;
    background: #fff;
    border-top: 1upx solid #e3e3e3;
    width: 100%;
    z-index: 1000;
}

.bottom-bar .submit-btn {
    background-color: #ff4544;
    color: #fff;
    width: 270upx;
    text-align: center;
    margin: 0;
    padding: 0 20upx;
    border-radius: 0;
}

.address-picker {
    background: #fff;
    padding: 32upx 24upx;
    margin-bottom: 20upx;
    border-top: 1upx solid #e3e3e3;
    border-bottom: 1upx solid #e3e3e3;
}

.cart-list {
}

.cart-checkbox {
    display: inline-block;
    width: 40upx;
    height: 40upx;
    background-size: 100% 100%;
    background-image: url();
}

.cart-checkbox.active {
    background-image: url();
}

.cart-item {
    background: #fff;
    padding: 32upx 24upx 10upx 24upx;
}

.cart-item .goods-pic {
    width: 156upx;
    height: 156upx;
    margin-right: 20upx;
}

.cart-item .goods-name {
    margin-bottom: 10upx;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item .attr-list,.cart-item .num {
    font-size: 9pt;
    color: #888;
}

.cart-item .attr-list .attr-item {
    display: inline-block;
    margin-right: 36upx;
}

.cart-item .attr-list .attr-item:last-child {
    margin-right: 0;
}

.cart-item .price {
    color: #ff4544;
}

.coupon-picker {
    position: fixed;
    top: var(--window-top);
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1001;
    background: #fff;
    border-top: 1upx solid #e3e3e3;
}

.coupon-list {
    padding: 34upx;
}

.coupon-list .coupon-item {
    height: 152upx;
    width: 682upx;
    position: relative;
    margin-bottom: 24upx;
}

.coupon-list .coupon-item.coupon-status-1 .coupon-right,.coupon-list .coupon-item.coupon-status-2 .coupon-right {
    color: rgba(0,0,0,0.35)!important;
}

.coupon-list .coupon-item .coupon-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

.coupon-list .coupon-item .coupon-status-icon {
    width: 140upx;
    height: 98upx;
    position: absolute;
    top: 0;
    right: 8upx;
    z-index: 1;
}

.coupon-list .coupon-item .coupon-left {
    color: #fff;
    width: 202upx;
}

.coupon-list .coupon-item .coupon-right {
    padding: 20upx 10upx;
}

.active {
    color: #ff4544;
}

.shop-block {
    width: 100%;
    height: 70upx;
    padding-left: 24upx;
}

.shop-address {
    width: 100%;
    background-color: #fff;
    padding: 30upx 24upx;
}

.goods-intrgral {
    height: 60upx;
    background-color: #fff7f6;
    width: 100%;
    border-bottom: 1upx solid #e3e3e3;
    color: #919191;
    font-size: 9pt;
    padding: 0 24upx;
}

.integral-switch .wx-switch-input {
    width: 42px;
    height: 22px;
}

.integral-switch .wx-switch-input::before {
    width: 41px;
    height: 20px;
}

.integral-switch .wx-switch-input::after {
    width: 20px;
    height: 20px;
}

.form-title {
    width: 100%;
    height: 72upx;
    line-height: 72upx;
    border-bottom: 1upx #e3e3e3 solid;
    color: #707070;
}

.form-list {
}

.form-one {
    padding: 24upx 0;
    border-bottom: 1upx #e3e3e3 solid;
}

.form-one:last-child {
    margin: 0;
    border: 0;
}

.required::before {
    content: '*';
    color: #ff4544;
}

.form-one .list-name {
    width: 170upx;
    justify-content: flex-end;
    text-align: right;
    margin-right: 20upx;
}

.default {
    height: 56prx;
    padding: 12upx 24upx;
    margin-right: 20upx;
    border-radius: 56upx;
    border: 1upx #ccc solid;
    color: #666;
    margin-bottom: 10upx;
}

.default:last-child {
    margin-right: 0;
}

.d-active {
    background-color: #ff4544;
    color: #fff;
    border: 1upx #ff4544 solid;
}

.right-jiantou {
    width: 12upx;
    height: 22upx;
    margin-left: 12upx;
}

.payment {
    width: 100%;
    height: 100%;
    position: fixed;
    left: 0;
    bottom: var(--window-bottom);
    z-index: 9999;
    background-color: rgba(0,0,0,0.5);
}

.pay-modal {
    width: 100%;
    position: absolute;
    left: 0;
    bottom: 0;
    background-color: #fff;
}

.pay-head {
    height: 80upx;
    width: 100%;
    color: #353535;
    border-bottom: 1upx #e2e2e2 solid;
}

.pay-block {
    width: 100%;
    height: 120upx;
    color: #999;
    padding: 0 30upx;
    border-bottom: 1upx #e2e2e2 solid;
}

.red {
    color: #ff4544;
}

.pay-footer {
    width: 100%;
    height: 88upx;
    background-color: #ff4544;
    color: #fff;
}

.store-header {
    background: #fff;
    padding: 24upx;
    border-bottom: 1upx solid #eeeeee;
}

.border-bottom {
    position: relative;
}

.border-bottom:after {
    content: " ";
    display: block;
    position: absolute;
    bottom: 0;
    left: 24upx;
    right: 24upx;
    height: 0;
    border-bottom: 1upx solid #eee;
}

.store-item {
    margin-bottom: 24upx;
}

.is_area {
    background: #FEBD14;
    font-size:;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.check-icon {
    width: 38upx;
    height: 38upx;
    border: 4upx solid #ccc;
    border-radius: 1000upx;
    position: relative;
    margin-right: 4upx;
}

.check-icon::after {
    position: absolute;
    content: " ";
    display: block;
    width: 22upx;
    height: 22upx;
    top: 4upx;
    left: 4upx;
    background: #e3e3e3;
    border-radius: 1000upx;
}

.active .check-icon::after {
    background: #ff4544;
}

.active .check-icon {
    border-color: #ff4544;
}
</style>
